package base;

/**
 * @Author DRevelation
 * @Date 2020-06-15 上午 11:08
 * @Desc
 */
public class ExtendEntity extends BaseEntity {
    private String sex;

    /**
     * 必须在父类中添加无参构造函数，或者向下面的构造方法调用super()方法--但是参数会变多，不符合实际要求
     * @param sex
     */
    // public ExtendEntity(String sex) {
    //     this.sex = sex;
    // }

    // @Override
    public ExtendEntity(int id, String name, int age) {
        super(id, name, age);
        System.out.println("extendEntity constructor");
    }

    public ExtendEntity(int id, String name, int age, String sex) {
        super(id, name, age);
        System.out.println("extendEntity constructor2");
        this.sex = sex;
    }

    @Override
    public void say() {
        System.out.println("extendEntity say");
    }

    public static void main(String[] args) {
        BaseEntity entity = new ExtendEntity(1, "abc", 22, "male");
        entity.say();
    }
}
